<?php
/**
 * Created on 2010-4-28
 *
 * @author Niap <zpr9527@163.com>
 *
 */
class floder {
 private $path; //(fopen,popen)(f,p)
 private $dir_name;
 private $mode='0777';
	function floder($dir_name,$path){
		$this->dir_name = $dir_name;
		$this->path = $path;
     }
    function set_dir_name($dir_name){
    	$this->dir_name = $dir_name;
    }
    function set_path($path){
    	$this->path = $path;
    }
 	function dir_exists() {
		   if(!$this->dir_name) return false;

		   if(is_dir($this->path.$this->dir_name)) return true;

//		   $tree = glob($this->path.'*', GLOB_ONLYDIR);
//		   if($tree && count($tree)>0) {
//		       foreach($tree as $dir)
//		           if(dir_exists($this->dir_name, $dir.'/'))
//		               return true;
//		   }
		   return false;
		}
	function makedir(){
		    $u=umask(0);
		    $r=@mkdir($this->dir_name.$this->path,$this->mode);
		    umask($u);
		    return $r;
		}
}
?>

